IMPORTANT NOTES

  • Necessary to avoid R variable names like variable.name since . in python is somewhat analogous to $ in R.
  • Follow the instructions in the stitches-in-R-setup R markdown so that this notebook will work. If you’ve followed that markdown, stitches should be installed in the r-reticulate virtual environment for this notebook and should be callable.

Setup

R

#### R  BLOCK ####
library(reticulate)
# # indicate that we want to use a specific virtualenv
use_virtualenv("r-reticulate", required =TRUE)


library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyr)
library(ggplot2)

# time slice for the map plotting:
map_time <- '2100-12-31'

python

#### Python Block ####
import stitches 
import pandas as pd
import pkg_resources
import xarray as xr 
import numpy as np
pd.set_option('display.max_columns', None)
#### Python Block ####
# The CMIP6 ESM we want to emulate and the variables we want to
# emulate
esm = ['CAMS-CSM1-0']
vars1 = ['tas', 'pr']

Load Hector data

pulled a quick rcp4.5 from HectorUI

#### R  BLOCK ####
hector_tgav <- read.csv('data/Hector-data-2022-09-22.csv', skip=3, stringsAsFactors = FALSE)
hector_exp <- unique(hector_tgav$scenario)
head(hector_tgav)
##                scenario year variable     value units
## 1 RCP  Standard-RCP-4.5 1800     Tgav 0.1176974  degC
## 2 RCP  Standard-RCP-4.5 1801     Tgav 0.1212491  degC
## 3 RCP  Standard-RCP-4.5 1802     Tgav 0.1243894  degC
## 4 RCP  Standard-RCP-4.5 1803     Tgav 0.1272345  degC
## 5 RCP  Standard-RCP-4.5 1804     Tgav 0.1298589  degC
## 6 RCP  Standard-RCP-4.5 1805     Tgav 0.1323124  degC

Reshape the Hector data to be stitches target

First we reshape the Hector time series to match the CMIP6 ESM GSAT smooth anomaly time series that STITCHES operates on: NOTE we should probably add this as a function to stitches NOTE Hector time series start in 1800 - there’s no science reason we couldn’t do matching over that window and have a gridded netcdf of an extra 50 years of history.

#### R  BLOCK ####
hector_tgav %>%
    mutate(variable = 'tas',
           ensemble = 'hectorUI1',# doesn't affect the matching or stitching
           model = 'Hector') %>%
    rename(experiment = scenario) %>% 
    filter(year >= 1850) %>%
    select(variable, experiment, ensemble, model, year, value,  -units) ->
    target_tgav

print(head(target_tgav))
##   variable            experiment  ensemble  model year      value
## 1      tas RCP  Standard-RCP-4.5 hectorUI1 Hector 1850 0.08854785
## 2      tas RCP  Standard-RCP-4.5 hectorUI1 Hector 1851 0.09338570
## 3      tas RCP  Standard-RCP-4.5 hectorUI1 Hector 1852 0.09959573
## 4      tas RCP  Standard-RCP-4.5 hectorUI1 Hector 1853 0.10672673
## 5      tas RCP  Standard-RCP-4.5 hectorUI1 Hector 1854 0.11386913
## 6      tas RCP  Standard-RCP-4.5 hectorUI1 Hector 1855 0.10890346
temp<-read.csv("../data/CAMS-CSM1-0_ssp126ave.csv")

target_tgav$value<-NA
target_tgav$value[match(temp$year,target_tgav$year)]<-temp$tgav
#target_tgav <- target_tgav[-251]

Convert Hector Tgav to stitches windows

Now that we have shaped it as stitches is expecting, we can use stitches functions to calculate the matching windows for this target data

#### Python Block ####
# smooth out Hector's historic volcano stuff and
# save off the smoothed Hector time series we actually use for matching so can plot later:      
target_hector = stitches.fx_processing.calculate_rolling_mean(r.target_tgav, size =31)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:50: FutureWarning: In a future version of pandas all arguments of DataFrame.drop except for the argument 'labels' will be keyword-only.
##   rslt = rslt.drop('value', 1).rename(columns={'rollingAvg': 'value'}).reset_index(drop=True)
target_data = stitches.fx_processing.get_chunk_info(
    stitches.fx_processing.chunk_ts(df = target_hector,  n=9))
      
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:121: FutureWarning: Passing a set as an indexer is deprecated and will raise in a future version. Use a list instead.
##   extra_info = df[extra_columns].drop_duplicates()
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:163: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
##   fx_dx_info = fx_dx_info.append(row)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_processing.py:171: SettingWithCopyWarning: 
## A value is trying to be set on a copy of a slice from a DataFrame.
## Try using .loc[row_indexer,col_indexer] = value instead
## 
## See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
##   extra_info["i"] = 1
print(target_data.head())
##     ensemble             experiment   model variable  start_yr  end_yr  year  \
## 0  hectorUI1  RCP  Standard-RCP-4.5  Hector      tas      1850    1858  1854   
## 1  hectorUI1  RCP  Standard-RCP-4.5  Hector      tas      1859    1867  1863   
## 2  hectorUI1  RCP  Standard-RCP-4.5  Hector      tas      1868    1876  1872   
## 3  hectorUI1  RCP  Standard-RCP-4.5  Hector      tas      1877    1885  1881   
## 4  hectorUI1  RCP  Standard-RCP-4.5  Hector      tas      1886    1894  1890   
## 
##          fx        dx  
## 0 -0.602934 -0.005883  
## 1 -0.621072 -0.001074  
## 2 -0.671851 -0.008360  
## 3 -0.689557  0.003447  
## 4 -0.670346 -0.001765

Load the stitches archive data for matching

##       ensemble variable        model experiment  start_yr  end_yr  year  \
## 4501  r1i1p1f1      tas  CAMS-CSM1-0     ssp126      1850    1858  1854   
## 4502  r1i1p1f1      tas  CAMS-CSM1-0     ssp126      1859    1867  1863   
## 4503  r1i1p1f1      tas  CAMS-CSM1-0     ssp126      1868    1876  1872   
## 4504  r1i1p1f1      tas  CAMS-CSM1-0     ssp126      1877    1885  1881   
## 4505  r1i1p1f1      tas  CAMS-CSM1-0     ssp126      1886    1894  1890   
## 
##             fx        dx  
## 4501 -0.459767 -0.002050  
## 4502 -0.624444 -0.031290  
## 4503 -0.769748  0.004645  
## 4504 -0.762718 -0.012289  
## 4505 -0.710355  0.030490

Match

#### python block ####
my_recipes = stitches.make_recipe(target_data, archive_data,
                                  non_tas_variables=['pr'],
                                  tol = 0.14, N_matches = 10000,
                                  reproducible = True)
## You have requested more recipes than possible for at least one target trajectories, returning what can
print(my_recipes.head())
##   target_start_yr target_end_yr archive_experiment archive_variable  \
## 0            1850          1858         historical              tas   
## 1            1859          1867         historical              tas   
## 2            1868          1876         historical              tas   
## 3            1877          1885         historical              tas   
## 4            1886          1894         historical              tas   
## 
##   archive_model archive_ensemble                       stitching_id  \
## 0   CAMS-CSM1-0         r2i1p1f1  RCP  Standard-RCP-4.5~hectorUI1~1   
## 1   CAMS-CSM1-0         r2i1p1f1  RCP  Standard-RCP-4.5~hectorUI1~1   
## 2   CAMS-CSM1-0         r1i1p1f1  RCP  Standard-RCP-4.5~hectorUI1~1   
## 3   CAMS-CSM1-0         r2i1p1f1  RCP  Standard-RCP-4.5~hectorUI1~1   
## 4   CAMS-CSM1-0         r1i1p1f1  RCP  Standard-RCP-4.5~hectorUI1~1   
## 
##   archive_start_yr archive_end_yr  \
## 0             1895           1903   
## 1             1886           1894   
## 2             1895           1903   
## 3             1904           1912   
## 4             1913           1921   
## 
##                                             tas_file  \
## 0  gs://cmip6/CMIP6/CMIP/CAMS/CAMS-CSM1-0/histori...   
## 1  gs://cmip6/CMIP6/CMIP/CAMS/CAMS-CSM1-0/histori...   
## 2  gs://cmip6/CMIP6/CMIP/CAMS/CAMS-CSM1-0/histori...   
## 3  gs://cmip6/CMIP6/CMIP/CAMS/CAMS-CSM1-0/histori...   
## 4  gs://cmip6/CMIP6/CMIP/CAMS/CAMS-CSM1-0/histori...   
## 
##                                              pr_file  
## 0  gs://cmip6/CMIP6/CMIP/CAMS/CAMS-CSM1-0/histori...  
## 1  gs://cmip6/CMIP6/CMIP/CAMS/CAMS-CSM1-0/histori...  
## 2  gs://cmip6/CMIP6/CMIP/CAMS/CAMS-CSM1-0/histori...  
## 3  gs://cmip6/CMIP6/CMIP/CAMS/CAMS-CSM1-0/histori...  
## 4  gs://cmip6/CMIP6/CMIP/CAMS/CAMS-CSM1-0/histori...

Unless otherwise specified by the argument reproducible = True, the draws stitches takes from the pool of matches is stochastic.

Within each of these ensembles, there’s no envelope collapse. If we were to concatenate them together into a super-ensemble, there would be. So it’s not as powerful as a very large ensemble of collapse free realizations but it’s still a distinct ensemble to consider.

stitch Tgav

#### python block ####
stitched_global_temp = stitches.gmat_stitching(my_recipes)
## /Users/snyd535/.virtualenvs/r-reticulate/lib/python3.9/site-packages/stitches/fx_stitch.py:344: FutureWarning: In a future version of pandas, a length 1 tuple will be returned when iterating over a groupby with a grouper equal to a list of length 1. Don't supply a list with a single grouper to avoid this warning.
##   for name, match in rp.groupby(['stitching_id']):
print(stitched_global_temp.head())
##    year     value variable                       stitching_id
## 0  1850 -0.748826      tas  RCP  Standard-RCP-4.5~hectorUI1~1
## 1  1851 -0.581701      tas  RCP  Standard-RCP-4.5~hectorUI1~1
## 2  1852 -0.474767      tas  RCP  Standard-RCP-4.5~hectorUI1~1
## 3  1853 -0.585308      tas  RCP  Standard-RCP-4.5~hectorUI1~1
## 4  1854 -0.473484      tas  RCP  Standard-RCP-4.5~hectorUI1~1

plot Tgav

## Warning in matrix(stitched_tgav$value, length(1850:2100), 5): data length [1004]
## is not a sub-multiple or multiple of the number of columns [5]

stitch gridded

Using the above recipes, stitches can produce new gridded netcdf files for each recipe, for multiple variables. Creating multiple netcdfs of monthly data is slower than focusing on GSAT. Still much faster than an ESM, and once the recipes are set, very parallelizable. But for tractability, we are just going to stitch the gridded netcdfs for one generated ensemble member.

#### python block ####
# Just do one realization
recipe = my_recipes[my_recipes['stitching_id'] == 'RCP  Standard-RCP-4.5~hectorUI1~1'].reset_index(drop=True).copy()

We must specify a directory for the netcdfs to be saved to. We will use simply do it directly here. On my computer, constructing these 4 netcdfs took ~2-3 minutes.

#### python block ####
stitches.gridded_stitching(out_dir='data', rp =recipe)
## ['Stitching gridded netcdf for: CAMS-CSM1-0 tas RCP  Standard-RCP-4.5~hectorUI1~1']
## ['data/stitched_CAMS-CSM1-0_tas_RCP  Standard-RCP-4.5~hectorUI1~1.nc', 'data/stitched_CAMS-CSM1-0_pr_RCP  Standard-RCP-4.5~hectorUI1~1.nc']

plot gridded setup

  • we will do maps of all 4 variables at a specified month and year
  • we will do a time series of each variable in a specific grid cell
## [1] "data/stitched_CAMS-CSM1-0_pr_RCP  Standard-RCP-4.5~hectorUI1~1.nc" 
## [2] "data/stitched_CAMS-CSM1-0_tas_RCP  Standard-RCP-4.5~hectorUI1~1.nc"

It’s a lot easier to use python to load in the netcdfs and select a grid cell or a time slice, save those off as simpler data frames than a full netcdf, and plot in R. The reshaping set of code that we often do in R to work with netcdf data is just so much faster if we’ve pre-sliced the data to a single grid cell or single time step in python.

tas

#### python block ####
[tas_time_slice, tas_grid_slice] = select_time_grid_slice(varname='tas')

Take a look at this data in R and plot it

## <xarray.DataArray 'tas' (lat: 160, lon: 320)>
## array([[267.88116, 267.91257, 267.8655 , ..., 267.8967 , 267.88245, 267.85605],
##        [266.10693, 265.94617, 266.01797, ..., 266.0147 , 266.2696 , 265.87897],
##        [266.76355, 266.97217, 266.93915, ..., 266.85504, 266.90277, 266.82892],
##        ...,
##        [242.1192 , 242.14171, 242.16599, ..., 242.10185, 242.1081 , 242.09921],
##        [241.67508, 241.69434, 241.70775, ..., 241.60387, 241.62997, 241.6528 ],
##        [241.35718, 241.37509, 241.39268, ..., 241.33455, 241.34186, 241.34927]],
##       dtype=float32)
## Coordinates:
##     time     datetime64[ns] 2100-12-31
##   * lat      (lat) float64 -89.14 -88.03 -86.91 -85.79 ... 86.91 88.03 89.14
##   * lon      (lon) float64 0.0 1.125 2.25 3.375 4.5 ... 355.5 356.6 357.8 358.9
## Attributes:
##     units:            K
##     variable:         tas
##     experiment:       historical
##     ensemble:         r2i1p1f1
##     model:            CAMS-CSM1-0
##     stitching_id:     RCP  Standard-RCP-4.5~hectorUI1~1
##     recipe_location:  data/stitched_CAMS-CSM1-0_tas_RCP  Standard-RCP-4.5~hec...

## <xarray.DataArray 'tas' (time: 3000)>
## array([271.2429 , 272.0805 , 278.03003, ..., 282.83716, 275.08975, 273.1367 ],
##       dtype=float32)
## Coordinates:
##   * time     (time) datetime64[ns] 1850-01-31 1850-02-28 ... 2099-12-31
##     lat      float64 38.69
##     lon      float64 256.5
## Attributes:
##     units:            K
##     variable:         tas
##     experiment:       historical
##     ensemble:         r2i1p1f1
##     model:            CAMS-CSM1-0
##     stitching_id:     RCP  Standard-RCP-4.5~hectorUI1~1
##     recipe_location:  data/stitched_CAMS-CSM1-0_tas_RCP  Standard-RCP-4.5~hec...

## Loading required package: spam
## Spam version 2.9-1 (2022-08-07) is loaded.
## Type 'help( Spam)' or 'demo( spam)' for a short introduction 
## and overview of this package.
## Help for individual functions is also obtained by adding the
## suffix '.spam' to the function name, e.g. 'help( chol.spam)'.
## 
## Attaching package: 'spam'
## The following objects are masked from 'package:base':
## 
##     backsolve, forwardsolve
## Loading required package: viridis
## Loading required package: viridisLite
## 
## Try help(fields) to get started.

pr

#### python block ####
[pr_time_slice, pr_grid_slice] = select_time_grid_slice(varname='pr')

Take a look at this data in R:

## <xarray.DataArray 'pr' (lat: 160, lon: 320)>
## array([[8.779846e-07, 1.044810e-06, 1.040847e-06, ..., 8.513659e-07,
##         8.526080e-07, 8.478734e-07],
##        [9.318699e-07, 7.758846e-07, 9.415436e-07, ..., 3.580494e-07,
##         8.652287e-07, 7.310244e-07],
##        [3.432085e-06, 4.102144e-06, 4.132919e-06, ..., 3.420937e-06,
##         3.185584e-06, 3.500774e-06],
##        ...,
##        [3.830799e-06, 3.803805e-06, 3.676216e-06, ..., 3.684879e-06,
##         3.910075e-06, 3.712560e-06],
##        [1.227253e-06, 1.231288e-06, 1.297264e-06, ..., 1.111799e-06,
##         1.432357e-06, 8.047313e-07],
##        [9.385178e-07, 9.380813e-07, 9.376278e-07, ..., 9.399242e-07,
##         9.392435e-07, 9.387159e-07]], dtype=float32)
## Coordinates:
##     time     datetime64[ns] 2100-12-31
##   * lat      (lat) float64 -89.14 -88.03 -86.91 -85.79 ... 86.91 88.03 89.14
##   * lon      (lon) float64 0.0 1.125 2.25 3.375 4.5 ... 355.5 356.6 357.8 358.9
## Attributes:
##     units:            kg m-2 s-1
##     variable:         pr
##     experiment:       historical
##     ensemble:         r2i1p1f1
##     model:            CAMS-CSM1-0
##     stitching_id:     RCP  Standard-RCP-4.5~hectorUI1~1
##     recipe_location:  data/stitched_CAMS-CSM1-0_pr_RCP  Standard-RCP-4.5~hect...

## <xarray.DataArray 'pr' (time: 3000)>
## array([7.364011e-06, 2.660703e-05, 8.277606e-06, ..., 3.328618e-05,
##        1.361743e-05, 1.056961e-05], dtype=float32)
## Coordinates:
##   * time     (time) datetime64[ns] 1850-01-31 1850-02-28 ... 2099-12-31
##     lat      float64 38.69
##     lon      float64 256.5
## Attributes:
##     units:            kg m-2 s-1
##     variable:         pr
##     experiment:       historical
##     ensemble:         r2i1p1f1
##     model:            CAMS-CSM1-0
##     stitching_id:     RCP  Standard-RCP-4.5~hectorUI1~1
##     recipe_location:  data/stitched_CAMS-CSM1-0_pr_RCP  Standard-RCP-4.5~hect...